import { createConnection } from 'typeorm';

export const databaseProviders = [
  {
    provide: 'DATABASE_CONNECTION',
    useFactory: async () => await createConnection({
      type: 'mysql',
      host: 'localhost',
      port: 3306,
      username: 'root',
      password: 'root',
      database: 'tomato',
      entities: [
          __dirname + '/../**/*.entity{.ts,.js}',
      ],
      // synchronize，开发模式下有利于debug，在生产模式下不要用
      synchronize: true,
      logging: true
    }),
  },
];